from typing import List


# 相同字母异序单词
def same_letter_different_word(words: List[str]) -> List[List[str]]:
    """
    找出集合中的相同字母异序单词，并用集合返回
    :param words: 字符串集合
    :return: 找出集合中的
    """
    word_dict = {}
    for word in words:
        # 将字符串拆分，并且按照字典序排列
        letter_list = list(word)
        letter_list.sort()
        letter_str = ''.join(letter_list)
        # 判断是否已经存在
        if letter_str not in word_dict:
            word_dict.setdefault(letter_str, [word])
        else:
            word_dict.get(letter_str).append(word)
    print(word_dict)
    return list(word_dict.values())


words_ = ['abc', 'bca', 'cba', 'nba', 'cat', 'tac', 'on', 'no', 'mp', 'pm', 'sql', 'mac']
print(same_letter_different_word(words_))

dict_1 = {'abc': 123, 'bca': 231}
dict_2 = {'bca': 231, 'abc': 123}
print(dict_1 == dict_2)
